<?php
namespace app\index\controller;

use think\Request;
use \app\admin\model\Category;

class Blank extends Base
{
    protected $blank_model;

    public function __construct(Request $request = null)
    {
        parent::__construct($request);

        $this->blank_model = new Category();
    }

    public function index($id = null)
    {
        if ($id == null) {
            $this->redirect('index/index');
        } else {
            $isshow = $this->blank_model->where('id', $id)->value('isshow');

            if ($isshow == 2) {
                $ids = $this->blank_model->getIds($id);

                $id = array_shift($ids);
            }

            $data = $this->blank_model->find($id);
            
            $this->assign('data', $data);
            
            return $this->fetch('index');
        }
    }
    
    public function aboutus($id = 1)
    {
        return $this->index($id);
    }

    public function service($id = 11)
    {
        return $this->index($id);
    }
}
